<%@page import="db_interaction.Fotos"%>
<%@page import="db_interaction.Amigos"%>
<div class="sidebar">

    <%
        Amigos a = new Amigos();
        Boolean res_seefriend = false;
        String email2 = request.getParameter("viewprofileEmail");
        String nome2 = request.getParameter("viewprofileNome");
        Fotos f = new Fotos();
        String caminho_foto_user = new String();
        //String email_user_login = (String) session.getAttribute("email");
        caminho_foto_user = f.SelectFoto(email2);
    %>
    <div class="gadget">
        <h2 class="star"><%= request.getParameter("viewprofileNome")%></h2>

        <img src="<% out.print("/TheHive/images/" + caminho_foto_user);%>" width="168px"></img>
        <a href="/TheHive/login/EditPersonalData.jsp">About</a>
    </div>

    <%
        res_seefriend = a.SeeFriend((String) session.getAttribute("email"), email2);
        if (res_seefriend) {

            out.print("<form method='post' id='form_add_user_friend' action='/TheHive/friends/addFriend.jsp'>");
            out.print("<span>");
            out.print("<input type='hidden' value='" + email2 + "' name='viewprofileEmail2' id='viewprofile'/>");
            out.print("<input type='hidden' value='" + nome2 + "' name='viewprofileNome2' id='viewprofile'/>");
            out.print("<input name='search' type='submit' style='width:169px' value='Add Friend' id='viewprofile' class='btn'/>");
            out.print("</span>");
            out.print("</form>");
        }
    %>

    <div class="search">
        <form method="get" id="search" action="/TheHive/others/ShowSearch.jsp">
            <span style="width: 170px; margin-left: 39px;">
                <input type="text" value="Procurar pessoas..." name="search" id="s" style="width: auto;"/>
                <input name="search" type="image" src="/TheHive/images/search.gif" value="Go" id="searchsubmit" class="btn" style="margin-top: -29px; margin-left: 135px;" />
            </span>
        </form>
        <!--/searchform -->
        <div class="clr"></div>
    </div>


    <div class="gadget">
        <h2 class="star"><span>Sidebar</span> Menu</h2>
        <div class="clr"></div>
        <ul class="sb_menu">
            <li><a href="/TheHive/login/MyProfile.jsp">Profile</a></li>
            <li><a href="/TheHive/friends/SeeFriends.jsp">Friends</a></li>
            <li><a href="/TheHive/messages/messages.jsp">Messages</a></li>
            <li><a href="/TheHive/photos/SeePhotos.jsp">Photos</a></li>
        </ul>
    </div>

</div>
<div class="clr"></div>
</div>
</div>
</div>
</html>

</body>
<script type="text/javascript">
        
    $('#form_add_user_friend').validationEngine();
  
    $( "#dialog_add_friend" ).dialog({
        modal: true,
        autoOpen: false,
        closeOnEscape: false,
        show: "blind",
        resizable: false,
        buttons: {
            Ok: function(dados) {
                history.go(0);
                $("#dialog_add_friend").remove().dialog("destroy");
                    
            }
        }
            
    });
        
    $('.btn').click(function() {
        $( "#dialog_add_friend" ).dialog('open');
    });
   
</script>